Skip to content

Wait for ADB connection before communicating with emulator#125

Merged
lfroms merged 2 commits intomainfrom
emulator-boot-wait
Mar 11, 2026
Merged

Wait for ADB connection before communicating with emulator#125
lfroms merged 2 commits intomainfrom
emulator-boot-wait

Conversation

@lfroms
Copy link
Member

@lfroms lfroms commented Mar 10, 2026

What does this change accomplish?

This change fixes an issue where Tophat sometimes displayed an error message when booting Android emulators due to a hardcoded sleep and unreliable AVD property querying that was previously used when waiting for an emulator to connect to ADB.

How have you achieved it?

By using emulator's -report-console to connect to a TCP socket that reports the port of the emulator on ADB before sending requests to ADB for that serial (then using wait-for-device to wait for boot). With a known port and serial, we can also rely on this value rather than querying for AVD properties which may still not be populated right after boot has completed.

How can the change be tested?

Boot a few Android emulators (using "Start" or by installing apps) a few times, both in isolation and in parallel and ensure emulators boot reliably (from warm and cold state).

@lfroms lfroms self-assigned this Mar 10, 2026
@lfroms lfroms force-pushed the emulator-boot-wait branch 2 times, most recently from 387f876 to 2063fbd Compare March 10, 2026 21:56
@lfroms lfroms force-pushed the emulator-boot-wait branch from 2063fbd to e7b47af Compare March 11, 2026 17:54
@lfroms lfroms marked this pull request as ready for review March 11, 2026 17:56
@lfroms lfroms merged commit fa10bb7 into main Mar 11, 2026
3 checks passed
@lfroms lfroms deleted the emulator-boot-wait branch March 11, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants